package form

type RegForm struct {
	Name       string `json:"name" form:"name" binding:"required"`
	Pwd        string `json:"pwd" form:"pwd" binding:"required"`
	ConfirmPwd string `json:"confirm_pwd" form:"confirm_pwd" binding:"required,eqfield=Pwd"`
}

func (RegForm) GetMessage() ValidatorMessages {
	return ValidatorMessages{
		"Name.required":       "请输入用户名",
		"Pwd.required":        "请输入密码",
		"ConfirmPwd.required": "请输入重复密码",
		"ConfirmPwd.eqfield":  "密码与重复密码不同",
	}
}

type LoginForm struct {
	Name string `json:"name" binding:"required"`
	Pwd  string `json:"pwd" binding:"required"`
}

func (LoginForm) GetMessage() ValidatorMessages {
	return ValidatorMessages{
		"Name.required": "请输入用户名",
		"Pwd.required":  "请输入密码",
	}
}

type ChangePwdForm struct {
	OldPwd     string `json:"old_pwd" binding:"required"`
	NewPwd     string `json:"new_pwd" binding:"required"`
	ConfirmPwd string `json:"confirm_pwd" binding:"required,eqfield=NewPwd"`
}

func (ChangePwdForm) GetMessage() ValidatorMessages {
	return ValidatorMessages{
		"OldPwd.required":     "请输入旧户名",
		"NewPwd.required":     "请输入新密码",
		"ConfirmPwd.required": "请输入确认密码",
		"ConfirmPwd.eqfield":  "密码与确认密码不对",
	}
}
